package operation;

import book.BookList;

import java.util.Scanner;

public class change implements IOperation{

    @Override
    public void work(BookList Booklist) {
        Scanner scanner = new Scanner(System.in);
        find findbyname = new find();
        System.out.print("请输入需要改变书籍的书名：");
        int number = findbyname.find_name(Booklist, scanner.next());
        if(number<0) {
            System.out.println("没有找到该书，修改失败！！！");
        } else {
            System.out.print("请更改书名：");
            Booklist.getBooklist()[number].setBookname(scanner.next());
            System.out.print("请更改作者：");
            Booklist.getBooklist()[number].setAuthor(scanner.next());
            System.out.print("请更改价格：");
            Booklist.getBooklist()[number].setPrice(scanner.nextDouble());
            System.out.print("请更改类型：");
            Booklist.getBooklist()[number].setType(scanner.next());
            System.out.println("修改成功！！！");
        }
    }
}